package com.yyfax.pay.order.model.to;

import org.apache.commons.lang3.StringUtils;

import com.yyfax.framework.exception.YYException;
import com.yyfax.framework.yyfax.enums.RspCodeEnum;
import com.yyfax.pay.common.model.to.YYPayParams;

/**
 * 收银台页面请求参数
 * 
 * @author buyi
 * @date 2017-04-13 16:06:33
 * @since v1.0.0
 */
@SuppressWarnings("serial")
public class CounterParams extends YYPayParams {

	/** 支付模块订单号 */
	private String payOrderId;
	/** 商户编号 */
	private String merchantCode;
	/** 支付通道 */
	private String paymentCode;

	public String getPayOrderId() {
		return payOrderId;
	}

	public void setPayOrderId(String payOrderId) {
		this.payOrderId = payOrderId;
	}

	public String getMerchantCode() {
		return merchantCode;
	}

	public void setMerchantCode(String merchantCode) {
		this.merchantCode = merchantCode;
	}

	public String getPaymentCode() {
		return paymentCode;
	}

	public void setPaymentCode(String paymentCode) {
		this.paymentCode = paymentCode;
	}

	@Override
	public boolean validate() throws YYException {
		if (StringUtils.isBlank(this.payOrderId)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'payOrderId'不能为空");
		}

		if (StringUtils.isBlank(this.merchantCode)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'merchantCode'不能为空");
		}

		if (StringUtils.isBlank(this.paymentCode)) {
			throw new YYException(RspCodeEnum.COMMON_ERROR_PARAMETER_INVALID, "参数 'paymentCode'不能为空");
		}

		return true;
	}

	@Override
	public String[] signFields() {
		return new String[] { "payOrderId", "merchantCode", "paymentCode" };
	}

}
